import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProfitReportParentAsinVO, ProfitReportParentAsinForm, ProfitReportParentAsinQuery } from '@/api/lingxing/profitReportParentAsin/types';

/**
 * 查询领星利润报告-父ASIN列表
 * @param query
 * @returns {*}
 */

export const listProfitReportParentAsin = (query?: ProfitReportParentAsinQuery): AxiosPromise<ProfitReportParentAsinVO[]> => {
  return request({
    url: '/lingxing/profitReportParentAsin/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询领星利润报告-父ASIN详细
 * @param id
 */
export const getProfitReportParentAsin = (id: string | number): AxiosPromise<ProfitReportParentAsinVO> => {
  return request({
    url: '/lingxing/profitReportParentAsin/' + id,
    method: 'get'
  });
};

/**
 * 新增领星利润报告-父ASIN
 * @param data
 */
export const addProfitReportParentAsin = (data: ProfitReportParentAsinForm) => {
  return request({
    url: '/lingxing/profitReportParentAsin',
    method: 'post',
    data: data
  });
};

/**
 * 修改领星利润报告-父ASIN
 * @param data
 */
export const updateProfitReportParentAsin = (data: ProfitReportParentAsinForm) => {
  return request({
    url: '/lingxing/profitReportParentAsin',
    method: 'put',
    data: data
  });
};

/**
 * 删除领星利润报告-父ASIN
 * @param id
 */
export const delProfitReportParentAsin = (id: string | number | Array<string | number>) => {
  return request({
    url: '/lingxing/profitReportParentAsin/' + id,
    method: 'delete'
  });
};

/**
 * 同步领星接口
 * @returns {*}
 */
export const syncData = (data?: ProfitReportParentAsinQuery) => {
  return request({
    url: '/lingxing/profitReportParentAsin/syncData',
    method: 'post',
    data: data
  });
};

export const getNewestUpdateTime = () => {
  return request({
    url: '/lingxing/profitReportParentAsin/getNewestUpdateTime',
    method: 'get'
  });
};
